<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html><head>
<title>deds</title>
</head><body>
<p>[<a href="mxdoc.htm">mainpage</a>]
[<a href="tags.htm">tags</a>]<br>
<h1><a name="deds">library: deds</a></h1><p><b>Data structures and utility functions for C</b><p>

This library contains various generic data structures and utility functions.

DEDS is used by <a href="degfx.htm">DEGFX</a> portable graphics library and
<a href="depui.htm">DEPUI</a> portable gui library.
 
(<a href="../include/deds/deds.h">../include/deds/deds.h</a>)<h2>modules:</h2><ul><li><a href="
deds_alloc.htm">alloc</a> 
Wrappers for C memory management functions with error checking</li>
<li><a href="
deds_atom.htm">atom</a> 
Reference counting atom with delete locking</li>
<li><a href="
deds_bool.htm">bool</a> 
Boolean true and false macros</li>
<li><a href="
deds_dllist.htm">dllist</a> 
Double linked list structure handling macros.</li>
<li><a href="
deds_maxmin.htm">maxmin</a> 
Simple macros for maximum and minimum of two values.</li>
<li><a href="
deds_memtype.htm">memtype</a> 
Typedefs for memory managment functions.</li>
<li><a href="
deds_rect.htm">rect</a> 
Basic rectangle handling</li>
<li><a href="
deds_rectatom.htm">rectatom</a> 
Rectangles with reference counting.</li>
<li><a href="
deds_string.htm">string</a> 
Some simple string allocation and handling functions.</li>
<li><a href="
deds_tree.htm">tree</a> 
Tree structure handling macros</li>
<li><a href="
deds_vector.htm">vector</a> 
A 100% typesafe generic vector for C.</li>
</ul><h2>documented objects:</h2><ul><li><a href="deds_alloc.htm# define MXMODULE_ALLOC"># define MXMODULE_ALLOC</a>
Turn on memory tracking</li>
<li><a href="deds_alloc.htm# define mx_malloc"># define mx_malloc</a>
Replacement for stdlib malloc</li>
<li><a href="deds_alloc.htm# define mx_realloc"># define mx_realloc</a>
Replacement for stdlib realloc</li>
<li><a href="deds_alloc.htm# define mx_free"># define mx_free</a>
Replacement for stdlib free</li>
<li><a href="deds_alloc.htm# define MXDEBUG_ALLOCTAG(p)"># define MXDEBUG_ALLOCTAG(p)</a>
Tag an allocation (debug)</li>
<li><a href="deds_alloc.htm# define MXDEBUG_ALLOCCHECK()"># define MXDEBUG_ALLOCCHECK()</a>
Check all allocations</li>
<li><a href="deds_atom.htm#MX_ATOM">MX_ATOM</a>
Base class for reference counting and delete locking</li>
<li><a href="deds_atom.htm# define MXATOM(v)"># define MXATOM(v)</a>
Convert to MX_ATOM</li>
<li><a href="deds_atom.htm# define mx_atom(a,d,s)"># define mx_atom(a,d,s)</a>
Construct an MX_ATOM</li>
<li><a href="deds_atom.htm# define mx_delete(a)"># define mx_delete(a)</a>
Destroy an MX_ATOM</li>
<li><a href="deds_atom.htm# define mx_locked(a)"># define mx_locked(a)</a>
Find out if an object is locked or not  </li>
<li><a href="deds_atom.htm#MX_LOCK">MX_LOCK</a>
Stop MX_ATOMs from getting deleted</li>
<li><a href="deds_atom.htm# define mx_lock(l,a)"># define mx_lock(l,a)</a>
Construct a MX_LOCK</li>
<li><a href="deds_atom.htm#unsigned mx_unlock(MX_LOCK* lock)">unsigned mx_unlock(MX_LOCK* lock)</a>
Destruct a MX_LOCK</li>
<li><a href="deds_atom.htm#unsigned mx_lastlock(const MX_LOCK* lock)">unsigned mx_lastlock(const MX_LOCK* lock)</a>
Find out if a lock is the last one of an object  </li>
<li><a href="deds_atom.htm# define MX_REF(type)"># define MX_REF(type)</a>
A reference type, a typed MX_LOCK</li>
<li><a href="deds_atom.htm# define mx_ref(r,t)"># define mx_ref(r,t)</a>
Construct a MX_REF</li>
<li><a href="deds_atom.htm# define mx_unref(r)"># define mx_unref(r)</a>
Destruct a MX_REF</li>
<li><a href="deds_atom.htm# define MXREF(r)"># define MXREF(r)</a>
Return the object behind a MX_REF</li>
<li><a href="deds_atom.htm#void* mx__atom(MX_ATOM* atom, MX__ATOM_DESTRUCT destruct, size_t datasize)">void* mx__atom(MX_ATOM* atom, MX__ATOM_DESTRUCT destruct, size_t datasize)</a>
Construct an MX_ATOM</li>
<li><a href="deds_bool.htm#define false">#define false</a>
Macro for false.  </li>
<li><a href="deds_bool.htm#define true">#define true</a>
Macro for true.  </li>
<li><a href="deds_dllist.htm#define MX_DLLIST(type)">#define MX_DLLIST(type)</a>
Double linked list</li>
<li><a href="deds_dllist.htm#define MX_DLLIST_ELEM(type)">#define MX_DLLIST_ELEM(type)</a>
Elements for a double linked list</li>
<li><a href="deds_dllist.htm#define MX_DLLIST_NODE(type,list)">#define MX_DLLIST_NODE(type,list)</a>
Elements for a double linked list node</li>
<li><a href="deds_dllist.htm#define MX_DLLIST_APPEND(o,p)">#define MX_DLLIST_APPEND(o,p)</a>
Insert a double linked element into a double linked list</li>
<li><a href="deds_dllist.htm#define MX_DLLIST_PREPEND(o,p)">#define MX_DLLIST_PREPEND(o,p)</a>
Insert a double linked element into a double linked list</li>
<li><a href="deds_dllist.htm#define MX_DLLIST_REMOVE(o)">#define MX_DLLIST_REMOVE(o)</a>
Remove a double linked list element from its list  </li>
<li><a href="deds_dllist.htm#define mx_dllist_first(o)">#define mx_dllist_first(o)</a>
First element of a double linked list.  </li>
<li><a href="deds_dllist.htm#define mx_dllist_last(o)">#define mx_dllist_last(o)</a>
Last element of a double linked list.  </li>
<li><a href="deds_dllist.htm#define mx_dllist_next(o)">#define mx_dllist_next(o)</a>
Next element in the double linked list. </li>
<li><a href="deds_dllist.htm#define mx_dllist_prev(o)">#define mx_dllist_prev(o)</a>
Previous element in the double linked list. </li>
<li><a href="deds_dllist.htm#define mx_dllist_list(o)">#define mx_dllist_list(o)</a>
List that an element is contained in.  </li>
<li><a href="deds_maxmin.htm#define MX_MAX(x,y)">#define MX_MAX(x,y)</a>
The maximum of two values.  </li>
<li><a href="deds_maxmin.htm#define MX_MIN(x,y)">#define MX_MIN(x,y)</a>
The minimum of two values.  </li>
<li><a href="deds_maxmin.htm#define MX_MID(x,y,z)">#define MX_MID(x,y,z)</a>
The middle of three values.  </li>
<li><a href="deds_memtype.htm#typedef void* (*MX_ALLOC) (size_t bytes);">typedef void* (*MX_ALLOC) (size_t bytes);</a>
A stdlib malloc-like function.  </li>
<li><a href="deds_memtype.htm#typedef void* (*MX_REALLOC) (void* ptr, size_t bytes);">typedef void* (*MX_REALLOC) (void* ptr, size_t bytes);</a>
A stdlib realloc-like function.  </li>
<li><a href="deds_memtype.htm#typedef void (*MX_FREE) (void* ptr);">typedef void (*MX_FREE) (void* ptr);</a>
A stdlib free-like function.  </li>
<li><a href="deds_memtype.htm#MX_ALLOCATOR">MX_ALLOCATOR</a>
A standard memory alloc/realloc/free tool  </li>
<li><a href="deds_rect.htm#MX_RECT">MX_RECT</a>
A basic rectangle</li>
<li><a href="deds_rect.htm# define MXRECT_VALID(A)"># define MXRECT_VALID(A)</a>
Is MX_RECT valid?</li>
<li><a href="deds_rect.htm# define MXRECT_INTERSECT(A, B, R)"># define MXRECT_INTERSECT(A, B, R)</a>
Find intersection of two rectangles</li>
<li><a href="deds_rect.htm# define MXRECT_UNION(A, B, R)"># define MXRECT_UNION(A, B, R)</a>
Union of two rectangles.  </li>
<li><a href="deds_rect.htm# define MXRECT_CONTAINS(R, X, Y)"># define MXRECT_CONTAINS(R, X, Y)</a>
Point contained in MX_RECT</li>
<li><a href="deds_rect.htm# define MXRECTS_OVERLAP(A, B)"># define MXRECTS_OVERLAP(A, B)</a>
Do MX_RECT overlap?</li>
<li><a href="deds_rect.htm#void mx_rect_move(MX_RECT* rrect, int x, int y)">void mx_rect_move(MX_RECT* rrect, int x, int y)</a>
Move a MX_RECT</li>
<li><a href="deds_rect.htm#void mx_rect_resize(MX_RECT* rrect, int w, int h)">void mx_rect_resize(MX_RECT* rrect, int w, int h)</a>
Resize a MX_RECT</li>
<li><a href="deds_rectatom.htm#MX_RECTATOM_DATA">MX_RECTATOM_DATA</a>
MX_RECT with reference counting  </li>
<li><a href="deds_rectatom.htm# define MXRECT(b)"># define MXRECT(b)</a>
Typesafe conversion between a class derived from MX_RECTATOM to a MX_RECT.  </li>
<li><a href="deds_rectatom.htm# define mx_rectatom(r,d,s)"># define mx_rectatom(r,d,s)</a>
Construct a MX_RECTATOM  </li>
<li><a href="deds_rectatom.htm# define mx_rectatom_place(r, rect)"># define mx_rectatom_place(r, rect)</a>
Place a MX_RECTAOM at some specific rectangle.  </li>
<li><a href="deds_rectatom.htm# define mx_x1(r)"># define mx_x1(r)</a>
MX_RECTATOM x1 value.  </li>
<li><a href="deds_rectatom.htm# define mx_y1(r)"># define mx_y1(r)</a>
MX_RECTATOM y1 value.  </li>
<li><a href="deds_rectatom.htm# define mx_x2(r)"># define mx_x2(r)</a>
MX_RECTATOM x2 value.  </li>
<li><a href="deds_rectatom.htm# define mx_y2(r)"># define mx_y2(r)</a>
MX_RECTATOM y2 value.  </li>
<li><a href="deds_rectatom.htm# define mx_w(r)"># define mx_w(r)</a>
MX_RECTATOM width.  </li>
<li><a href="deds_rectatom.htm# define mx_h(r)"># define mx_h(r)</a>
MX_RECTATOM height.  </li>
<li><a href="deds_rectatom.htm#void* mx__rectatom(MX_RECTATOM_DATA* rectatom, MX__ATOM_DESTRUCT destruct, size_t size)">void* mx__rectatom(MX_RECTATOM_DATA* rectatom, MX__ATOM_DESTRUCT destruct, size_t size)</a>
Construct a MX_RECTATOM.  </li>
<li><a href="deds_rectatom.htm#void mx__rectatom_place(MX_RECTATOM_DATA* rectatom, const MX_RECT* rrect)">void mx__rectatom_place(MX_RECTATOM_DATA* rectatom, const MX_RECT* rrect)</a>
Place a MX_RECTATOM</li>
<li><a href="deds_string.htm#MX_STRING">MX_STRING</a>
A string object  </li>
<li><a href="deds_string.htm#void mx_string_realloc(MX_STRING* string, const MX_ALLOC alloc, const MX_FREE dfree)">void mx_string_realloc(MX_STRING* string, const MX_ALLOC alloc, const MX_FREE dfree)</a>
Reallocate a MX_STRING</li>
<li><a href="deds_string.htm#void mx_string_set(MX_STRING* string, const char* text, int len, const MX_FREE dfree)">void mx_string_set(MX_STRING* string, const char* text, int len, const MX_FREE dfree)</a>
Set MX_STRING text and length</li>
<li><a href="deds_string.htm#void mx_string(MX_STRING* string)">void mx_string(MX_STRING* string)</a>
Construct a MX_STRING</li>
<li><a href="deds_string.htm#void mx_string_free(MX_STRING* string)">void mx_string_free(MX_STRING* string)</a>
Destruct a MX_STRING</li>
<li><a href="deds_string.htm#const char* mx_string_text(const MX_STRING* string, int* len)">const char* mx_string_text(const MX_STRING* string, int* len)</a>
Get MX_STRING text and length</li>
<li><a href="deds_string.htm#int mx_string_len(const MX_STRING* string)">int mx_string_len(const MX_STRING* string)</a>
Get MX_STRING length</li>
<li><a href="deds_tree.htm#define MX_TREE(type)">#define MX_TREE(type)</a>
Declare elements for a tree structure</li>
<li><a href="deds_tree.htm#define MX_TREE_INSERT(o,p)">#define MX_TREE_INSERT(o,p)</a>
Insert a tree element into a parent. </li>
<li><a href="deds_tree.htm#define MX_TREE_REMOVE(o)">#define MX_TREE_REMOVE(o)</a>
Remove a tree element from a parent.  </li>
<li><a href="deds_tree.htm#define mx_tree_first(o)">#define mx_tree_first(o)</a>
The first child element of a parent.  </li>
<li><a href="deds_tree.htm#define mx_tree_last(o)">#define mx_tree_last(o)</a>
The last child element of a parent.  </li>
<li><a href="deds_tree.htm#define mx_tree_next(o)">#define mx_tree_next(o)</a>
The next child element with the same parent.  </li>
<li><a href="deds_tree.htm#define mx_tree_prev(o)">#define mx_tree_prev(o)</a>
The previous child element with the same parent.  </li>
<li><a href="deds_tree.htm#define mx_tree_parent(o)">#define mx_tree_parent(o)</a>
The parent tree element.  </li>
<li><a href="deds_vector.htm#define MX_VECTOR(type)">#define MX_VECTOR(type)</a>
A 100% typesafe generic vector for C</li>
<li><a href="deds_vector.htm#define MX_VECTOR_ITERATOR(type)">#define MX_VECTOR_ITERATOR(type)</a>
An iterator for a MX_VECTOR</li>
<li><a href="deds_vector.htm#define mx_vector(mxvect)">#define mx_vector(mxvect)</a>
Construct a MX_VECTOR</li>
<li><a href="deds_vector.htm#define mx_vector_free(mxvect)">#define mx_vector_free(mxvect)</a>
Destruct a MX_VECTOR</li>
<li><a href="deds_vector.htm#define mx_vector_at(mxvect, mxn)">#define mx_vector_at(mxvect, mxn)</a>
Return an element from a MX_VECTOR at a specific index</li>
<li><a href="deds_vector.htm#define mx_vector_back(mxvect)">#define mx_vector_back(mxvect)</a>
Return the last element from a MX_VECTOR</li>
<li><a href="deds_vector.htm#define mx_vector_begin(mxvect)">#define mx_vector_begin(mxvect)</a>
Pointer to first element</li>
<li><a href="deds_vector.htm#define mx_vector_capacity(mxvect)">#define mx_vector_capacity(mxvect)</a>
Capacity</li>
<li><a href="deds_vector.htm#define mx_vector_clear(mxvect)">#define mx_vector_clear(mxvect)</a>
Clear</li>
<li><a href="deds_vector.htm#define mx_vector_empty(mxvect)">#define mx_vector_empty(mxvect)</a>
Empty</li>
<li><a href="deds_vector.htm#define mx_vector_end(mxvect)">#define mx_vector_end(mxvect)</a>
Pointer one-past last element</li>
<li><a href="deds_vector.htm#define mx_vector_erase(mxvect, mxiter)">#define mx_vector_erase(mxvect, mxiter)</a>
Erase an element</li>
<li><a href="deds_vector.htm#define mx_vector_push_back(mxvect, mxdat)">#define mx_vector_push_back(mxvect, mxdat)</a>
Push an element onto the back of the MX_VECTOR</li>
<li><a href="deds_vector.htm#define mx_vector_size(mxvect)">#define mx_vector_size(mxvect)</a>
Number of elements</li>
<li><a href="deds_vector.htm#define mx_vector_resize(mxvect, n)">#define mx_vector_resize(mxvect, n)</a>
Resize</li>
<li><a href="deds_vector.htm#define mx_vector_reserve(mxvect, n)">#define mx_vector_reserve(mxvect, n)</a>
Set capacity</li>
<li><a href="deds_vector.htm#define mx_vector_extend(mxvect, n)">#define mx_vector_extend(mxvect, n)</a>
Increase capacity</li>
<li><a href="deds_vector.htm#define mx_vector_contract(mxvect)">#define mx_vector_contract(mxvect)</a>
Reduce capacity to minimum</li>
<li><a href="deds_vector.htm#define mx_vector_append1(mxvect, dat)">#define mx_vector_append1(mxvect, dat)</a>
Append 1 element (bitwise copy)</li>
<li><a href="deds_vector.htm#define mx_vector_append(mxvect, dat, n)">#define mx_vector_append(mxvect, dat, n)</a>
Append a number of elements (bitwise copy)</li>
<li><a href="deds_vector.htm#define mx_vector_insert1(mxvect, dat, ind)">#define mx_vector_insert1(mxvect, dat, ind)</a>
Insert 1 element (bitwise copy)</li>
<li><a href="deds_vector.htm#define mx_vector_insert(mxvect, dat, n, ind)">#define mx_vector_insert(mxvect, dat, n, ind)</a>
Insert a number of elements (bitwise copy)</li>
<li><a href="deds_vector.htm#define mx_vector_remove_last(mxvect)">#define mx_vector_remove_last(mxvect)</a>
Remove last element</li>
<li><a href="deds_vector.htm#size_t mx__vector_makeroom(MX__VECTOR_DATA* vect, const size_t num, const size_t place, const size_t sizeofdata)">size_t mx__vector_makeroom(MX__VECTOR_DATA* vect, const size_t num, const size_t place, const size_t sizeofdata)</a>
</li>
</ul><p>Generated by <a href="http://www.deleveld.dds.nl/mxdoc/index.htm">MXDOC</a> 2.2 on Sun Feb  4 15:16:27 2007


</body></html>
